<div class="bjui-pageHeader">
    <form id="pagerForm" data-toggle="ajaxsearch" action="${request.getContextPath()}/OrderStatusAnalysis/orderStatusAnalysisStepTwo" method="post">
        <div class="bjui-searchBar">
            <g:hiddenField name="SYS_QUERY_NAME" value="orderStatusAnalysisStepTwo" />
            <g:hiddenField name="EXPORT_CONTENT_NAME" value="Excel" />
            <g:hiddenField name="docId1" value="${params.docId1}"/>
            <g:hiddenField name="step" value="${params.step}"/>
            <g:hiddenField name="scrap" value="${params.scrap}"/>
            <g:hiddenField name="lineNum1" value="${params.lineNum1}"/>
            <label >批次号：</label>&nbsp;
        <g:select name="lotId" from="${orderStatusAnalysisScrapStepTwoLotList}" data-toggle="selectpicker" data-live-search="true" optionKey="lot_id" optionValue="lot_id" value="${lotId}" noSelection="['':'ALL']" />&nbsp;

            <button type="submit" class="btn-default" data-icon="search">查询</button>&nbsp;
            <button type="button" class="btn-blue" onclick="javascript:bjuiExportExl('#pagerForm','${request.getContextPath()}/StageWip/exportExcel')" data-icon="file-excel-o" title="导出Excel">导出</button>&nbsp;
        </div>
    </form>
</div>

<div class="panel-body">
    <div style="mini-width:400px;height:450px;" id="cellGlassOutputDiv"></div>
</div>

<div class="bjui-pageContent">
    <g:if test="${orderStatusAnalysisScrapStepTwo.size() > 0}">
        <table  data-toggle="tablefixed" data-width="100%" data-nowrap="true">
            <thead>
            <tr id="t1">
                <g:each in="${tableHeadList}" status="j" var="headInstance">
                    <g:if test="${headInstance!='RN'}">
                        <th  width="125"><g:message code="${headInstance}" default="${headInstance}"/></th>
                    </g:if>
                </g:each>
            </tr>
            </thead>
            <tbody>
            <g:if test="${orderStatusAnalysisScrapStepTwo.size()>0}">
                <g:each in="${orderStatusAnalysisScrapStepTwo}" status="i" var="dataInstance">
                    <tr>
                        <g:each in="${tableHeadList}" status="j" var="headInstance">
                            <g:if test="${headInstance=='MAIN_QTY'&&headInstance!='RN'}">
                                <td name="lotqty${i}">${dataInstance["${headInstance}"]}</td>
                            </g:if>
                            <g:if test="${headInstance=='STAY_TIME'&&headInstance!='RN'}">
                                <td name="staytime${i}">${dataInstance["${headInstance}"]}</td>
                            </g:if>
                            <g:elseif test="${headInstance!='RN'&&headInstance!='MAIN_QTY'}">
                                <td>${dataInstance["${headInstance}"]}</td>
                            </g:elseif>
                        </g:each>
                    </tr>
                </g:each>
                <tr>
                    <td colspan="8">小计(当前页)</td>
                    <td name="sumLot">0</td>
                </tr>
                <tr>
                    <td colspan="8">合计(总)</td>
                    <td >${orderStatusAnalysisScrapStepTwoSum[0].SUM_QTY}</td>
                </tr>
            </g:if>
            <g:else>
                <g:render template="../template/emptyPanel" />
            </g:else>
            </tbody>
        </table>
    </g:if>
</div>
<g:render template="../template/51pagination" />
<script>
    $(function(){
        var s2=0;
        for(var i=0;i<${orderStatusAnalysisScrapStepTwo.size()};i++){
            var s3='lotqty'+i

            var sumS1=$("td[name='"+s3+"']").text()==''?0:parseInt($("td[name='"+s3+"']").text())
            s2+=sumS1


        }
        $("td[name='sumLot']").html(s2)
        for(var i=0;i<${orderStatusAnalysisScrapStepTwo.size()};i++){
            var nameStay="staytime"+i;
            var stayTime=parseFloat($("td[name='"+nameStay+"']").text())
            if(stayTime>=1&&stayTime<3){
                $("td[name='"+nameStay+"']").css("background-color","#FFFF6F")
                $("td[name='"+nameStay+"']").nextAll().css("background-color","#FFFF6F")
                $("td[name='"+nameStay+"']").prevAll().css("background-color","#FFFF6F")

            }else if(stayTime>=3&&stayTime<7){
                $("td[name='"+nameStay+"']").css("background-color","#FF9797")
                $("td[name='"+nameStay+"']").nextAll().css("background-color","#FF9797")
                $("td[name='"+nameStay+"']").prevAll().css("background-color","#FF9797")
            }else if(stayTime>=7){
                $("td[name='"+nameStay+"']").css("background-color","#FF5151")
                $("td[name='"+nameStay+"']").nextAll().css("background-color","#FF5151")
                $("td[name='"+nameStay+"']").prevAll().css("background-color","#FF5151")
            }
        }
    })
</script>